using System;
using UnityEngine;

[Serializable]
public class finalscore : MonoBehaviour
{
	public int score;

	public string prefix;

	public string prefix2;

	public string scoresave;

	public GUIText text;

	public GUIText text2;

	public string leaderBoard;

	public finalscore()
	{
		prefix = "High Score: ";
		prefix2 = "Exp Earned: ";
		scoresave = string.Empty;
		leaderBoard = "6400 :8]";
	}

	public void getscore()
	{
		text.text = prefix + score;
		score = Mathf.FloorToInt(Mathf.Min(score, 100000));
		Social.ReportScore(score, leaderBoard, Check);
		if (score > PlayerPrefs.GetInt(scoresave))
		{
			PlayerPrefs.SetInt(scoresave, score);
		}
		PlayerPrefs.SetInt("Matches Played", PlayerPrefs.GetInt("Matches Played") + 1);
		PlayerPrefs.SetInt("Wins", PlayerPrefs.GetInt("Wins") + 1);
		PlayerPrefs.SetInt("Exp", PlayerPrefs.GetInt("Exp") + score / 10);
		text2.text = "Exp: " + score / 10 + " Total: " + PlayerPrefs.GetInt("Exp");
		JCAchievementMunger.CheckProgress();
		if (score > 9000)
		{
			JCAchievementMunger.UnlockAchievement("CgkI3_DHnsgeEAIQDA");
		}
		if (score >= 4000)
		{
			JCAchievementMunger.UnlockAchievement("CgkI3_DHnsgeEAIQCw");
		}
		PlayerPrefs.Save();
	}

	public void Check(bool result)
	{
		if (result)
		{
			UnityEngine.Debug.Log("score submission successful");
		}
		else
		{
			UnityEngine.Debug.Log("score submission failed");
		}
	}

	public void Main()
	{
	}
}
